package tr.edu.metu.is.mega.server.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 * The persistent class for the team database table.
 */
@Entity
public class Team implements Serializable, tr.edu.metu.is.mega.server.core.BaseEntity {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer pkid;

    private String logo;

    private String teamname;

    // bi-directional many-to-one association to Reviewer
    @OneToMany(mappedBy = "reviewerTeam")
    private List<Reviewer> reviewers1;

    // bi-directional many-to-one association to Reviewer
    @OneToMany(mappedBy = "team")
    private List<Reviewer> reviewers2;

    // bi-directional many-to-one association to Submission
    @OneToMany(mappedBy = "team")
    private List<Submission> submissions;

    // bi-directional many-to-one association to Course
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "fk_courseid")
    private Course course;

    // bi-directional many-to-one association to Teammember
    @OneToMany(mappedBy = "team", cascade = CascadeType.ALL, orphanRemoval = true)
    private List<Teammember> teammembers;

    /**
     * Default constructor.
     */
    public Team() {
    }

    /**
     * Returns pkid.
     * 
     * @return the pkid
     */
    @Override
    public Integer getPkid() {
        return pkid;
    }

    /**
     * Sets pkid value.
     * 
     * @param pkid the pkid to set
     */
    @Override
    public void setPkid(Integer pkid) {
        this.pkid = pkid;
    }

    /**
     * Returns logo.
     * 
     * @return the logo
     */
    public String getLogo() {
        return logo;
    }

    /**
     * Sets logo value.
     * 
     * @param logo the logo to set
     */
    public void setLogo(String logo) {
        this.logo = logo;
    }

    /**
     * Returns teamname.
     * 
     * @return the teamname
     */
    public String getTeamname() {
        return teamname;
    }

    /**
     * Sets teamname value.
     * 
     * @param teamname the teamname to set
     */
    public void setTeamname(String teamname) {
        this.teamname = teamname;
    }

    /**
     * Returns reviewers1.
     * 
     * @return the reviewers1
     */
    public List<Reviewer> getReviewers1() {
        return reviewers1;
    }

    /**
     * Sets reviewers1 value.
     * 
     * @param reviewers1 the reviewers1 to set
     */
    public void setReviewers1(List<Reviewer> reviewers1) {
        this.reviewers1 = reviewers1;
    }

    /**
     * Returns reviewers2.
     * 
     * @return the reviewers2
     */
    public List<Reviewer> getReviewers2() {
        return reviewers2;
    }

    /**
     * Sets reviewers2 value.
     * 
     * @param reviewers2 the reviewers2 to set
     */
    public void setReviewers2(List<Reviewer> reviewers2) {
        this.reviewers2 = reviewers2;
    }

    /**
     * Returns submissions.
     * 
     * @return the submissions
     */
    public List<Submission> getSubmissions() {
        return submissions;
    }

    /**
     * Sets submissions value.
     * 
     * @param submissions the submissions to set
     */
    public void setSubmissions(List<Submission> submissions) {
        this.submissions = submissions;
    }

    /**
     * Returns course.
     * 
     * @return the course
     */
    public Course getCourse() {
        return course;
    }

    /**
     * Sets course value.
     * 
     * @param course the course to set
     */
    public void setCourse(Course course) {
        this.course = course;
    }

    /**
     * Returns teammembers.
     * 
     * @return the teammembers
     */
    public List<Teammember> getTeammembers() {
        return teammembers;
    }

    /**
     * Sets teammembers value.
     * 
     * @param teammembers the teammembers to set
     */
    public void setTeammembers(List<Teammember> teammembers) {
        this.teammembers = teammembers;
    }

}
